package org.jeecg.modules.online.cgform.converter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jeecg.common.util.MyClassLoader;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.online.auth.p004b.AuthConstants;
import org.jeecg.modules.online.cgform.converter.p011b.CatTreeConverter;
import org.jeecg.modules.online.cgform.converter.p011b.DateFormatConverter;
import org.jeecg.modules.online.cgform.converter.p011b.DepartConverter;
import org.jeecg.modules.online.cgform.converter.p011b.DictEasyConverter;
import org.jeecg.modules.online.cgform.converter.p011b.DictTableConverter;
import org.jeecg.modules.online.cgform.converter.p011b.LinkDownConverter;
import org.jeecg.modules.online.cgform.converter.p011b.MultiSelectConverter;
import org.jeecg.modules.online.cgform.converter.p011b.PcaConverter;
import org.jeecg.modules.online.cgform.converter.p011b.SwitchConverter;
import org.jeecg.modules.online.cgform.converter.p011b.TreeSelectConverter;
import org.jeecg.modules.online.cgform.converter.p011b.UserSelectConverter;
import org.jeecg.modules.online.cgform.entity.OnlCgformField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/* renamed from: org.jeecg.modules.online.cgform.converter.a */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/converter/a.class */
public class ConvertFactory {

    /* renamed from: a */
    private static final Logger f154a = LoggerFactory.getLogger(ConvertFactory.class);

    /* renamed from: b */
    private static final String f155b = "list";

    /* renamed from: c */
    private static final String f156c = "radio";

    /* renamed from: d */
    private static final String f157d = "checkbox";

    /* renamed from: e */
    private static final String f158e = "list_multi";

    /* renamed from: f */
    private static final String f159f = "sel_search";

    /* renamed from: g */
    private static final String f160g = "sel_tree";

    /* renamed from: h */
    private static final String f161h = "cat_tree";

    /* renamed from: i */
    private static final String f162i = "link_down";

    /* renamed from: j */
    private static final String f163j = "sel_depart";

    /* renamed from: k */
    private static final String f164k = "sel_user";

    /* renamed from: l */
    private static final String f165l = "pca";

    /* renamed from: m */
    private static final String f166m = "switch";

    /* renamed from: n */
    private static final String f167n = "input";

    /* renamed from: o */
    private static final String f168o = "date";

    /* renamed from: a */
    public static FieldCommentConverter m399a(OnlCgformField onlCgformField) {
    	 String fieldShowType = onlCgformField.getFieldShowType();
    	 FieldCommentConverter fieldCommentConverter = null;
         switch (fieldShowType) {
             case "list":
             case "radio":   fieldCommentConverter = new DictEasyConverter(onlCgformField);  break;
             case "list_multi":
             case "checkbox":  fieldCommentConverter = new MultiSelectConverter(onlCgformField); break;
             case "sel_search":  fieldCommentConverter = new DictTableConverter(onlCgformField);  break;
             case "sel_tree":  fieldCommentConverter = new TreeSelectConverter(onlCgformField);  break;
             case "cat_tree":  fieldCommentConverter = new CatTreeConverter(onlCgformField);   break;
             case "link_down":  fieldCommentConverter = new LinkDownConverter(onlCgformField); break;
             case "sel_depart":  fieldCommentConverter = new DepartConverter(onlCgformField);  break;
             case "sel_user":  fieldCommentConverter = new UserSelectConverter(onlCgformField);  break;
             case "pca":  fieldCommentConverter = new PcaConverter(onlCgformField);   break;
             case "switch": fieldCommentConverter = new SwitchConverter(onlCgformField);  break;
             case "input":
                 String dictField = onlCgformField.getDictField();
                 if (dictField == null || "".equals(dictField)) {
                     fieldCommentConverter = null;
                     break;
                 } else {
                     fieldCommentConverter = new DictEasyConverter(onlCgformField);
                     break;
                 }
             case "date":  fieldCommentConverter = new DateFormatConverter(onlCgformField);  break;
             default:  fieldCommentConverter = null;
         }
         return fieldCommentConverter;
    }

    /* renamed from: a */
    public static Map<String, FieldCommentConverter> m400a(List<OnlCgformField> list) {
        FieldCommentConverter m399a;
        HashMap hashMap = new HashMap(5);
        for (OnlCgformField onlCgformField : list) {
            if (oConvertUtils.isNotEmpty(onlCgformField.getConverter())) {
                m399a = m401a(onlCgformField.getConverter().trim());
            } else {
                m399a = m399a(onlCgformField);
            }
            if (m399a != null) {
                hashMap.put(onlCgformField.getDbFieldName().toLowerCase(), m399a);
            }
        }
        return hashMap;
    }

    /* renamed from: a */
    private static FieldCommentConverter m401a(String str) {
        Object var1 = null;
        if (str.indexOf(".") > 0) {
            try {
                var1 = MyClassLoader.getClassByScn(str).newInstance();
            } catch (InstantiationException var3) {
            	f154a.error(var3.getMessage(), var3);
            } catch (IllegalAccessException var4) {
            	f154a.error(var4.getMessage(), var4);
            }
        } else {
            var1 = SpringContextUtils.getBean(str);
        }

        if (var1 != null && var1 instanceof FieldCommentConverter) {
            FieldCommentConverter var2 = (FieldCommentConverter)var1;
            return var2;
        } else {
            return null;
        }
    }
}
